<?php
//рус
class App_Module_Admin_Layout extends Mozg_Layout
{
    private $_activeMenuElement;

    /**
		устаавливает активный элемент в меню основного шаблона
     */
    public function SetMenuActiveElement ($menuElement)
    {
        $this->_activeMenuElement = $menuElement;
        return $this;
    }
    
    public function GetMenuActiveElement ()
    {
        return $this->_activeMenuElement;
    }
    
    protected function GetMainMenu()
    {
        $t = $this->GetTpl('Base');
        $t->userMenu = Mozg::Ctrl('admin', 'default', 'http', 'web')->GetUserMenuFromCache();
        $t->menuActiveElement = $this->GetMenuActiveElement();
        return $t->MainMenu();
    }
    
    /**
		шаблон default
     */
    protected function DefaultTmp ()
    {
        $this->SetDefaultHeaders();
        Mozg::Response('http')->SetHeader('Content-Type', 'text/html; charset=UTF-8');
        
        $t = $this->GetTpl('Base');
        $t->siteName = Mozg_Cfg::Get('site/global')->GetSiteName();
        $t->mainMenu = $this->GetMainMenu();
        $t->userStatus = Mozg::Ctrl('admin', 'users', 'http', 'web')->userstatus();
        $t->leftPane = implode('', Mozg::SubAction()->Get('Left Sidebar'));
        $t->rightPane = implode('', Mozg::SubAction()->Get('Right Sidebar'));
        $t->bottomScript = implode('', Mozg::SubAction()->Get('RequiredJS'));
        $t->content = Mozg::Response('http')->GetBody();
        $t->messages = Mozg::Lib('messanger')->getAllMessages();
        $t->user = Mozg::User();
        
        $t->activeRoute = Mozg::Router('http')->GetActiveRoute();

        Mozg::Response('http')->SetBody($t->DefaultTmp());
    }
    /**
		шаблон login
     */
    protected function LoginTmp ()
    {
        $this->SetDefaultHeaders();
        Mozg::Response('http')->SetHeader('Content-Type', 'text/html; charset=UTF-8');
        
        $t = $this->GetTpl('Base');
        $t->siteName = Mozg_Cfg::Get('site/global')->GetSiteName();
        $t->basePath = Mozg::Request('http')->GetBasePath();
        $t->content = Mozg::Response('http')->GetBody();
        $t->messages = Mozg::Lib('messanger')->getAllMessages();
        
        Mozg::Response('http')->SetBody($t->LoginTmp());
    }

    /**
		шаблон empty
     */
    protected function EmptyTmp ()
    {
        $this->SetDefaultHeaders();
        Mozg::Response('http')->SetHeader('Content-Type', 'text/html; charset=UTF-8');
        
        $t = $this->GetTpl('Base');
        $t->bottomScript = implode('', Mozg::SubAction()->Get('RequiredJS'));
        $t->content = Mozg::Response('http')->GetBody();

        Mozg::Response('http')->SetBody($t->EmptyTmp());
    }
    
    /**
		шаблон std
     */
    protected function StdTmp ()
    {
        
    }
}